MAKE_FLAGS = -C

SRC_PATH = src/
BIN_PATH = bin/

DBMODEL_PATH = $(SRC_PATH)DB\ Model/
CLIENT_PATH = $(SRC_PATH)client/
COMMON_PATH = $(SRC_PATH)common/
LOG_PATH = $(SRC_PATH)log/
RSA_PATH = $(SRC_PATH)rsa/
SERVER_PATH = $(SRC_PATH)server/
SHA2_PATH = $(SRC_PATH)sha2/
TWOFISH_PATH = $(SRC_PATH)twofish/

.PHONY: clean

all: clean rsa sha2 twofish log client server #dbmodel common

#SHELL = /bin/sh

clean:
	make clean $(MAKE_FLAGS) $(CLIENT_PATH)
	#make clean $(MAKE_FLAGS) $(DBMODEL_PATH)
	make clean $(MAKE_FLAGS) $(COMMON_PATH)
	make clean $(MAKE_FLAGS) $(LOG_PATH)
	make clean $(MAKE_FLAGS) $(RSA_PATH)
	make clean $(MAKE_FLAGS) $(SERVER_PATH)
	make clean $(MAKE_FLAGS) $(SHA2_PATH)
	make clean $(MAKE_FLAGS) $(TWOFISH_PATH)
	- rm -f $(BIN_PATH)*
	
client:
	make $(MAKE_FLAGS) $(CLIENT_PATH)
	mv $(CLIENT_PATH)client $(BIN_PATH)	
	
dbmodel:
	make $(MAKE_FLAGS) $(DBMODEL_PATH)

common:
	make $(MAKE_FLAGS) $(COMMON_PATH)
	mv $(COMMON_PATH)keygen $(BIN_PATH)

	
log:
	make $(MAKE_FLAGS) $(LOG_PATH)
	mv $(LOG_PATH)getlog $(BIN_PATH)
	
rsa:
	make $(MAKE_FLAGS) $(RSA_PATH)	
	
server:
	make $(MAKE_FLAGS) $(SERVER_PATH)
	mv $(SERVER_PATH)privilegeadd $(BIN_PATH)
	mv $(SERVER_PATH)privilegedel $(BIN_PATH)
	mv $(SERVER_PATH)sectoradd $(BIN_PATH)
	mv $(SERVER_PATH)useradd $(BIN_PATH)
	mv $(SERVER_PATH)server $(BIN_PATH)
	
			
sha2:
	make $(MAKE_FLAGS) $(SHA2_PATH)

twofish:
	make $(MAKE_FLAGS) $(TWOFISH_PATH)
	
#launch: $(shell $(BIN_PATH)server)

